home *** CD-ROM | disk | FTP | other *** search
/ CSi Master: Pro Tools 6 / CSi Master: Pro Tools 6.iso / mac / QuickTime Installer-0SX / QuickTime.pkg / Contents / Resources / preflight < prev    next >
Encoding:
Text File  |  2003-07-07  |  1.3 KB  |  65 lines

  1. #!/usr/bin/perl
  2.  
  3. my $runnerPID = getppid();
  4. my $installerPID = "";
  5. my $uid = "";
  6. my $uname = "";
  7.  
  8. open( PSOUT, "/bin/ps -axww -o pid,ppid -p $runnerPID |" );
  9. while( <PSOUT> ) {
  10.     my @fields = split '\s+', $_;
  11.     if ("$fields[1]" eq "$runnerPID") {
  12.         $installerPID = $fields[2];
  13.     }
  14. }
  15. close( PSOUT );
  16.  
  17. if ("$installerPID" ne "") {
  18.     open( PSOUT, "/bin/ps -axww -o pid,ruid -p $installerPID |" );
  19.     while( <PSOUT> ) {
  20.         my @fields = split '\s+', $_;
  21.         if ("$fields[1]" eq "$installerPID") {
  22.             $uid = $fields[2];
  23.         }
  24.     }
  25.     close( PSOUT );
  26. }
  27.  
  28. if ("$uid" ne "") {
  29.     open( PSOUTA, "/usr/bin/id -p $uid |" );
  30.     while( <PSOUTA> ) {
  31.         my @fields = split '\s+', $_;
  32.         if ("$fields[0]" eq "uid") {
  33.             $uname = $fields[1];
  34.         }
  35.     }
  36.     close( PSOUTA );
  37. }
  38.  
  39. my $ALERT_APP = "$ARGV[0]" . "/Contents/Resources/QT6Installer.app/Contents/MacOS/QT6Installer";
  40. my $EXIT_VALUE = 0;
  41.  
  42. my $cmd = "\"$ALERT_APP\" -showregistration";
  43. if ("$uname" ne "") {
  44.     $cmd = "sudo -u $uname \"$ALERT_APP\" -showregistration";
  45.  
  46. $EXIT_VALUE = system("$cmd");
  47.  
  48. if (($EXIT_VALUE >> 8) != 0) {
  49.     if ("$installerPID" ne "") {
  50.         kill "QUIT", $installerPID;
  51.     }
  52.     kill "QUIT", $runnerPID;
  53.     exit($EXIT_VALUE >> 8);
  54. }
  55.  
  56. my $CLEANUP_PREFS = "$ARGV[0]" . "/Contents/Resources/cleanprefs";
  57.  
  58. my $cmd = "\"$CLEANUP_PREFS\"";
  59. if ("$uname" ne "") {
  60.     $cmd = "sudo -u $uname \"$CLEANUP_PREFS\"";
  61. }
  62. system("$cmd");
  63.  
  64.